home *** CD-ROM | disk | FTP | other *** search
/ ftp.cs.arizona.edu / ftp.cs.arizona.edu.tar / ftp.cs.arizona.edu / icon / newsgrp / group03a.txt / 000050_icon-group-sender_Wed Mar 26 12:54:54 2003.msg < prev    next >
Internet Message Format  |  2003-12-22  |  1KB

  1. Return-Path: <icon-group-sender>
  2. Received: (from root@localhost)
  3.     by baskerville.CS.Arizona.EDU (8.11.1/8.11.1) id h2QJsr208601
  4.     for icon-group-addresses; Wed, 26 Mar 2003 12:54:53 -0700 (MST)
  5. Message-Id: <200303261954.h2QJsr208601@baskerville.CS.Arizona.EDU>
  6. X-Sender: whm@mail.mse.com (Unverified)
  7. Date: Wed, 26 Mar 2003 10:35:55 -0700
  8. To: voice_of_reason@australia.edu (Quiet Voice)
  9. From: "William H. Mitchell" <whm86@mse.com>
  10. Subject: Re: newbie questions -- ressurected
  11. Cc: icon-group@cs.arizona.edu
  12. Errors-To: icon-group-errors@cs.arizona.edu
  13. Status: RO
  14.  
  15. At 06:20 AM 3/26/03 -0800, Quiet Voice wrote:
  16. >Thank you for this response and to all who have responded directly by
  17. >e:mail. The suggestions were all helpful and did solve the problem.
  18. >
  19. >The next level of dilemma: I would like to sort the list.
  20. >
  21. >I've tried various permutations of code using the sort() function. The
  22. >errors I get seeme to be related to a type mis-match caused by the
  23. >output type of sort().
  24. >
  25. >Example
  26. >
  27. >write(!sort(data,2)) 
  28.  
  29. sort(t,2) produces a list of two-element lists ([key,value] pairs) ordered
  30. by the values.
  31.  
  32. I suspect the problem you're seeing is that you're trying to write() a list
  33. and unfortunately, that's not allowed (no structure types are valid as
  34. arguments to write).  I usually do something like this:
  35.  
  36.   every pair := !sort(data,2) do
  37.      write(pair[1], " ", pair[2])
  38.  
  39. William Mitchell
  40. Mitchell Software Engineering
  41. www.mse.com
  42.  
  43.